package com.liang.demo.service.impl;

import com.liang.demo.mapper.AdminMapper;
import com.liang.demo.po.Admin;
import com.liang.demo.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 陈琪亮
 * @version 1.0
 * @date 2021/3/18 16:38
 */
@Service
public class AdminServiceImpl implements AdminService {

    @Autowired
    private AdminMapper adminMapper;

    @Override
    public Admin getAdminInfo(Long adminId) {
        Admin admin = adminMapper.selectById(adminId);
        return admin;
    }

    @Override
    public Admin login(String userName, String password) {
        Admin admin = adminMapper.selectByNameAndPwd(userName, password);
        admin.setPassword("");
        return admin;
    }

    @Override
    public List<Admin> getAdminAll() {
        return adminMapper.getAdminAll();
    }
}
